package com.example.service.login.impl;

import com.example.dao.login.UserDao;
import com.example.pojo.Authority;
import com.example.pojo.User;
import com.example.pojo.UserDevelopment;
import com.example.service.login.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    //查询密码
    public User get(String account){
        return userDao.get(account);
    }

    public List quanxian(String account){
        List d = new ArrayList();
        User user = userDao.get(account);
        List id = id(d,user.getGrade());
        return id;
    }
    //权限
    public List id(List d1,int s){
        List<Authority> quanxian = userDao.quanxian(); //全部
        for (Authority au : quanxian) {
            if(au.getTrId()==s){
                d1.add(s);
                id(d1,au.getParentId());
            }
        }
        return d1;
    }
}